import { GoodsCateItem } from './goods-cate';
import { defHttp } from '/@/utils/http/axios';

enum Api {
  Crud = '/wms/goods',
  Table = '/wms/goods/table',
  List = '/wms/goods/list',
}

export const getTableData = (params:any) => defHttp.get<GoodsItem[]>({ url: Api.Table, params: params });

export const getListData = () => defHttp.get<GoodsItem[]>({ url: Api.List });

export const create = (params: any) => defHttp.post({url: Api.Crud, params});

export const update = (params: any) => defHttp.put({url: Api.Crud, params});

export const deletes = (params: number[]) => defHttp.delete({url: Api.Crud, data: params});

export interface GoodsItem {
  ID: number,
  code: string,
  name: string;
  memo: string;
  enable: number;
  specs: string;
  qty: number;
  price: number;
  isGift: number;
  cate: GoodsCateItem;
}

